package uscdb.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import uscdb.service.PoiService;

@Controller
@RequestMapping("/exportController")
public class ExportController extends BaseController {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(ExportController.class);

	@Autowired
	private PoiService poiService;

	@RequestMapping("/exportProjectToExcel")
	public void exportProjectToExcel(HttpServletRequest request, HttpServletResponse response) {
		try {
			response.setContentType("application/msexcel;charset=GBK");
			poiService.exportProjectToExcel(request, response);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
		}
	}

}
